package com.sanery.service.impl;

import java.util.List;

import com.sanery.dao.LinkDao;
import com.sanery.dao.MyBatisUtil;
import com.sanery.entity.Link;
import com.sanery.service.LinkService;

public class LinkServiceImpl implements LinkService {

	@Override
	public List<Link> getMyLink(Integer id) {
		LinkDao dao = MyBatisUtil.getSession().getMapper(LinkDao.class);
		List<Link> links = dao.getMyLink(id);
		return links;
	}

	@Override
	public void delLink(Integer id, Integer userId) {
		LinkDao dao = MyBatisUtil.getSession().getMapper(LinkDao.class);
		dao.delLink(id, userId);
	}

	@Override
	public List<Link> getSortLink(String string, Integer id) {
		LinkDao dao = MyBatisUtil.getSession().getMapper(LinkDao.class);
		List<Link> list = dao.getSortList(string, id);
		return list;
	}

	@Override
	public void changeLink(Integer cardId, String name, Integer type, String phone, String email, Integer userId) {
		LinkDao dao = MyBatisUtil.getSession().getMapper(LinkDao.class);
		dao.changeLink(cardId, name, type, phone, email, userId);
	}

	@Override
	public void createLink(String name, Integer type, String phone, String email, Integer userId) {
		LinkDao dao = MyBatisUtil.getSession().getMapper(LinkDao.class);
		dao.createLink(name, type, phone, email, userId);
	}

	@Override
	public List<Link> searchLink(String val, Integer userId) {
		LinkDao dao = MyBatisUtil.getSession().getMapper(LinkDao.class);
		List<Link> list = dao.searchLink(val, userId);
		return list;
	}

}
